<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>demo1</title>
</head>

<body>
    <div id="main" style="width: 1000px;height:800px;"></div>
    <!-- 基本库 -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/4.2.1/echarts.js"></script>
    <!-- Gl库(3D图形)-->
    <script src="https://www.echartsjs.com/dist/echarts-gl.js"></script>
    <script>
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));
        option = {
            tooltip: {},
            visualMap: {
                show: false,
                dimension: 2,
                min: -1,
                max: 1,
                inRange: {
                    color: ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf', '#fee090', '#fdae61',
                        '#f46d43', '#d73027', '#a50026'
                    ]
                }
            },
            xAxis3D: {},
            yAxis3D: {},
            zAxis3D: {},
            grid3D: {},
            series: [{
                type: 'surface',
                parametric: true,
                // shading: 'albedo',
                parametricEquation: {
                    u: {
                        min: -Math.PI,
                        max: Math.PI,
                        step: Math.PI / 20
                    },
                    v: {
                        min: 0,
                        max: Math.PI,
                        step: Math.PI / 20
                    },
                    x: function (u, v) {
                        return Math.sin(v) * Math.sin(u);
                    },
                    y: function (u, v) {
                        return Math.sin(v) * Math.cos(u);
                    },
                    z: function (u, v) {
                        return Math.cos(v);
                    }
                }
            }]
        };
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>
</body>

</html>